package com.example.lenovo.fragmenttest;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

public class LeftFragment extends Fragment {
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.left_fragment, container, false);
        return view;
    }

    public void test() {
        Toast.makeText(getContext(), "活动中调用碎片方法", Toast.LENGTH_SHORT).show();
    }

    public void test2() {
        MainActivity activity = (MainActivity) getActivity();
        activity.test();
    }
}
